package Java核心技术1;

import org.junit.Test;

class Employee {
    private String name;
    private double salary;

    public Employee(String name, double salary) {
        this.name = name;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public double getSalary() {
        return salary;
    }

    public void reiseSalary(double x) {
        double r = this.salary * x / 100;
        salary += r;

    }

}

public class ParamTest {

    @Test
    public void test1() {
        double p = 10;
        System.out.println(p); //1000
        tripValue(p); //3000
        System.out.println(p); //1000
    }

    @Test
    public void test2() {
        Employee s = new Employee("s", 5000);
        System.out.println(s.getSalary()); //5000
        tripleSalary(s);//15000
        System.out.println(s.getSalary()); //15000

    }

    private void tripleSalary(Employee s) {
        s.reiseSalary(200);
        System.out.println(s.getSalary());

    }

    private static void tripValue(double x) {
        x = x * 3;
        System.out.println(x);
    }
}
